home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip0493.zip / X00API.H < prev    next >
C/C++ Source or Header  |  1993-04-05  |  6KB  |  190 lines

  1. /*
  2.  *  X00API.H - X00 FOSSIL driver HLLAPI
  3.  *   
  4.  *   Created by R.F. Pels.
  5.  *   modified by Bob Stout
  6.  *   Placed in the public domain.
  7.  */
  8.  
  9. /* port numbers and variable type of portnumber in calls */
  10.  
  11. #define PORTCOM1            0
  12. #define PORTCOM2            1
  13. #define PORTCOM3            2
  14. #define PORTCOM4            3
  15. #define PORTCOM5            4
  16. #define PORTCOM6            5
  17. #define PORTCOM7            6
  18. #define PORTCOM8            7
  19. #define PORTSPECIAL         0x00ff
  20.  
  21. typedef unsigned int PORT;
  22.  
  23. /* defines components of baud settings call */
  24.  
  25. #define BAUD300             0x40
  26. #define BAUD600             0x60
  27. #define BAUD1200            0x80
  28. #define BAUD2400            0xa0
  29. #define BAUD4800            0xc0
  30. #define BAUD9600            0xe0
  31. #define BAUD19200           0x00
  32. #define BAUD38400           0x20
  33. #define PARITYNONE          0x00
  34. #define PARITYODD           0x08
  35. #define PARITYNONEALT       0x10
  36. #define PARITYEVEN          0x18
  37. #define STOP1BIT            0x00
  38. #define STOP2BIT            0x04
  39. #define WORD5BIT            0x00
  40. #define WORD6BIT            0x01
  41. #define WORD7BIT            0x02
  42. #define WORD8BIT            0x03
  43. #define FIDOSETTING         PARITYNONE | STOP1BIT | WORD8BIT
  44. #define OPUSSETTING         PARITYNONE | STOP1BIT | WORD8BIT
  45. #define SEADOGSETTING       PARITYNONE | STOP1BIT | WORD8BIT
  46.  
  47. /* Error numbers */
  48.  
  49. #define X00_OK              0
  50. #define X00_NOT_HERE        100
  51. #define X00_CHAR_NOT_SENT   101
  52. #define X00_NO_INPUT        0xffff
  53. #define X00_NO_KEY          0xffff
  54. #define X00_INS_TICK        104
  55. #define X00_DEL_TICK        105
  56. #define X00_INS_APP         106
  57. #define X00_REM_APP         107
  58. #define X00_DTR_HIGH        108
  59. #define X00_DTR_LOW         109
  60.  
  61.  
  62. /* FOSSIL initcall result type */
  63.  
  64. #define X00_PRESENT         0x1954
  65.  
  66. typedef struct {
  67.         unsigned int result;
  68.         unsigned char max_function;
  69.         unsigned char revision;
  70.         } FOSSILINIT;
  71.  
  72. /* FOSSIL status return type: all fields are 1 if condition exists */
  73.  
  74. typedef union {
  75.         struct STATUSBITS {
  76.             unsigned int                   : 3;
  77.             unsigned int alwayshigh        : 1;
  78.             unsigned int                   : 3;
  79.             unsigned int carrier_detect    : 1;
  80.             unsigned int chars_in_input    : 1;
  81.             unsigned int input_overrun     : 1;
  82.             unsigned int                   : 3;
  83.             unsigned int output_not_full   : 1;
  84.             unsigned int output_empty      : 1;
  85.             unsigned int                   : 1;
  86.             } statusbits;
  87.       unsigned int statusword;
  88.       } FOSSILSTATUS;
  89.  
  90. /* FOSSIL info type */
  91.  
  92. typedef struct {
  93.         unsigned int  size;
  94.         unsigned char version;
  95.         unsigned char revision;
  96.         unsigned int  ofs_fossil_id;
  97.         unsigned int  seg_fossil_id;
  98.         unsigned int  input_size;
  99.         unsigned int  input_avail;
  100.         unsigned int  output_size;
  101.         unsigned int  output_avail;
  102.         unsigned char screen_width;
  103.         unsigned char screen_height;
  104.         unsigned char baud_rate_mask;
  105.         } FOSSILINFO;
  106.  
  107. /* FOSSIL system info type */
  108.  
  109. typedef struct {
  110.         unsigned char tick_number;
  111.         unsigned char ticks_per_second;
  112.         unsigned int  approx_ms_per_tick;
  113.         } FOSSILSYSINFO;
  114.  
  115. /* FOSSIL flow control type */
  116.  
  117. typedef union {
  118.         struct FLOWBITS {
  119.             unsigned char xonxoff         : 1;
  120.             unsigned char ctsrts          : 1;
  121.             unsigned char remote_xonxoff  : 1;
  122.             unsigned char                 : 5;
  123.             } flowbits;
  124.       unsigned char flowword;
  125.       } FOSSILFLOWCTRL;
  126.  
  127. /* FOSSIL checks control type */
  128.  
  129. #define X00_CTLCK           0x0001
  130. #define X00_NO_CTLCK        0x0000
  131.  
  132. typedef union {
  133.         struct CHECKBITS {
  134.             unsigned char ctlc_ctlk         : 1;
  135.             unsigned char stop_transmitter  : 1;
  136.             unsigned char                   : 6;
  137.             } checkbits;
  138.       unsigned char checkword;
  139.       } FOSSILCTLCCTLK;
  140.  
  141. #define COLDBOOT        0
  142. #define WARMBOOT        1
  143.  
  144. #if __cplusplus
  145.  extern "C" {
  146. #endif
  147.  
  148. unsigned int  x00_detect(void);
  149. FOSSILSTATUS  x00_set(unsigned char set, PORT port);
  150. FOSSILSTATUS  x00_tx_char(unsigned char c, PORT port);
  151. unsigned char x00_rx_char(PORT port);
  152. FOSSILSTATUS  x00_status(PORT port);
  153. FOSSILINIT    x00_init(PORT port, unsigned char far *ctlc_flagbyte);
  154. void          x00_deinit(PORT port);
  155. unsigned int  x00_raise_dtr(PORT port);
  156. unsigned int  x00_lower_dtr(PORT port);
  157. FOSSILSYSINFO x00_sysinfo(void);
  158. void          x00_flush_output(PORT port);
  159. void          x00_purge_output(PORT port);
  160. void          x00_purge_input(PORT port);
  161. unsigned int  x00_tx_char_nowait(unsigned char c, PORT port);
  162. unsigned int  x00_peek_ahead_input(PORT port);
  163. unsigned int  x00_peek_ahead_kbd(void);
  164. unsigned int  x00_read_kbd(void);
  165. void          x00_flow_control(FOSSILFLOWCTRL f, PORT port);
  166. unsigned int  x00_ctlc_ctlk_check(FOSSILCTLCCTLK c, PORT port);
  167. void          x00_set_cup(unsigned char row, unsigned char col);
  168. void          x00_get_cup(unsigned char *row, unsigned char *col);
  169. void          x00_write_ANSI_char(unsigned char c);
  170. void          x00_enable_watchdog(PORT port);
  171. void          x00_disable_watchdog(PORT port);
  172. void          x00_write_BIOS_char(unsigned char c);
  173. unsigned int  x00_insert_tick_func(void (_far *tickfunc)());
  174. unsigned int  x00_delete_tick_func(void (_far *tickfunc)());
  175. void          x00_boot_machine(unsigned int boottype);
  176. unsigned int  x00_read_block(unsigned int count, void far *buf, PORT port);
  177. unsigned int  x00_write_block(unsigned int count, void far *buf, 
  178. PORT port);
  179. void          x00_start_break_signal(PORT port);
  180. void          x00_stop_break_signal(PORT port);
  181. unsigned int  x00_get_driverinfo(void far *buf, PORT port);
  182. unsigned int  x00_install_appendage(unsigned char appcode,
  183.                   void (_far *appfunc)());
  184. unsigned int  x00_remove_appendage(unsigned char appcode, 
  185.                   void (_far *appfunc)());
  186.  
  187. #if __cplusplus
  188.  }
  189. #endif
  190.